<%@ page contentType="text/html;charset=UTF-8" %>

<!DOCTYPE html>
<html>
<head>
	<title>数据字典-条目</title>
	<%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/import.jsp" %>
	<script type="text/javascript" src="${ctx}/js/zbxtools.js"></script>
	<script type="text/javascript" src="${ctx}/js/easyui/extendvalidate.js"></script>
	<script type="text/javascript">
		var inputForm = '#inputForm';
		$(function(){
			$('#inputForm').form({
			    success:function(data){
			    	var result = jQuery.parseJSON(data);
			    	if(result.flag=='T'){
			    		$.messager.alert('提交结果', '操作成功', 'info',function(){
			    		    parent.colseAdd();//关闭窗口
			    		    if("0"=="${dataItem.fatherId}" || ""=="${dataItem.fatherId}"){
			    		    	parent.itemReloadFull();
			    		    }else{
			    		    	parent.reloadTree('${dataItem.fatherId}','${dataItem.itemId}');
			    		    }
			    		});
			    	}else{
			    		$.messager.alert('提交结果', '操作失败:'+result.msg, 'error');
			    	}        
			    },
				error: function(messg){
					$.messager.alert('错误提示', '操作失败:'+messg.responseText, 'error');
				}
			});
		});
		
		function doSubmit(){
			var flag = $(inputForm).form('validate');
			if(flag){
				//ZBXTools.showProcess('正在提交数据...');
				$(inputForm).submit();
			}
		}
	</script>
</head>
<body>	

<div id="tip"></div>
	<form id="inputForm" name="inputForm" method="post" action="${ctx}/dict/item/save.action">
		<input type="hidden" name="formToken" id="formToken" value="${formToken}"/>
		<input type="hidden" name="cateEname" id="cateEname" value="${item.cateEname}"/>
		<input type="hidden" name="fatherId" id="fatherId" value="${item.fatherId}"/>
		<input type="hidden" name="itemId" id="itemId" value="${item.itemId}"/>
		<table class="datagrid-body" >
			<tr>
				<td class="datagrid-header">条目名称<font color=red>*</font></td>
				<td>
					<input id="itemText" name="itemText"  value="${item.itemText}"
					class="easyui-validatebox" data-options="required:true,validType:'length[1,200]',validType:'CHS'" size="50"  
					missingMessage="条目名称" invalidMessage="应为1~200个字" />
				</td>
			</tr>
			<tr >
				<td class="datagrid-header">条目值<font color=red>*</font></td>
				<td>
					<input name="itemValue"  id="actCname" value="${item.itemValue}"  
					class="easyui-validatebox" data-options="required:true,validType:'length[1,200]'" size="50" 
					missingMessage="条目值" invalidMessage="应为1~200个字" />				
				</td>
			</tr>
			<tr >
				<td class="datagrid-header">子节点数</td>
				<td>
					<input name="subCount"  id="subCount" value="${item.subCount}"
					class="easyui-validatebox" data-options="required:true" size="5"  readonly="readonly" />				
				</td>
			</tr>
			<tr>
				<td class="datagrid-header">描述</td>
				<td>
					<input id="itemRemark" name="itemRemark"  value="${item.itemRemark}"
					class="easyui-validatebox" size="50" data-options="required:false,validType:'length[2,30]'" 
					missingMessage="描述" invalidMessage="应为2~30个字" />
				</td>
			</tr>			
			<tr>
				<td class="datagrid-header">状态<font color=red>*</font></td>
				<td>
					<input type="radio" name="itemStatus" id="itemStatus_1" value="1" />启用
					<input type="radio" name="itemStatus"  id="itemStatus_0" value="0" />停用
				</td>
			</tr>
			<tr>
				<td class="datagrid-header"></td>
				<td >	
					<a href="#" class="easyui-linkbutton" id="bt1" iconCls="icon-save" onclick="doSubmit();">提交</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="parent.colseAdd();"; >取消</a>				
				</td>
			</tr>
		</table>
	</form>
</body>
</html>

<script type="text/javascript">
ZBXTools.initRadio("itemStatus","${item.itemStatus}");
</script>